Ubuntu 16.04
Sponsored Link

OpenStack Newton : How to use Ceilometer
2016/12/22
 
How to use the OpenStack Metering Service (Ceilometer).
This example is based on the environment like follows.
                                |
+------------------+            |            +------------------------+
| [ Control Node ] |            |            |    [ Network Node ]    |
|     Keystone     |10.0.0.30   |   10.0.0.50|    DHCP,L3,L2 Agent    |
|      Glance      |------------+------------|     Metadata Agent     |
|     Nova API     |eth0        |        eth0|   Ceilometer Services  |
|  Neutron Server  |            |            |                        |
+------------------+            |            +------------------------+
                            eth0|10.0.0.51
                      +--------------------+
                      |  [ Compute Node ]  |
                      |    Nova Compute    |
                      |      L2 Agent      |
                      | Ceilometer-Compute |
                      +--------------------+

[1] If you configured Ceilometer#1, Ceilometer#2, Ceilometer#3, the command below shows some results without errors like follows. (no Data is shown yet)
root@dlp ~(keystone)#
ceilometer meter-list

+------+------+------+-------------+---------+------------+
| Name | Type | Unit | Resource ID | User ID | Project ID |
+------+------+------+-------------+---------+------------+
+------+------+------+-------------+---------+------------+
[2] Configure to enable monitoring Compute Service (Nova).
# configure on Compute Service Node

root@node01:~#
vi /etc/nova/nova.conf
# add into [DEFAULT] section

instance_usage_audit = True
instance_usage_audit_period = hour
notify_on_state_change = vm_and_task_state
# add to the end

[oslo_messaging_notifications]
driver = messagingv2
root@node01:~#
systemctl restart nova-compute
# after configuring, data is loged like follows when an instance is used and so on

root@dlp ~(keystone)#
ceilometer meter-list

+---------------------+-------+------+-------------------------+-------------------------+---------------------------+
| Name                | Type  | Unit | Resource ID             | User ID                 | Project ID                |
+---------------------+-------+------+-------------------------+-------------------------+---------------------------+
| disk.ephemeral.size | gauge | GB   | 94afe31b-659b-4f61-.... | b48cbdf1975f4fd3987.... | 1b8227c2c89e4f1cbcbbb.... |
| disk.root.size      | gauge | GB   | 94afe31b-659b-4f61-.... | b48cbdf1975f4fd3987.... | 1b8227c2c89e4f1cbcbbb.... |
| memory              | gauge | MB   | 94afe31b-659b-4f61-.... | b48cbdf1975f4fd3987.... | 1b8227c2c89e4f1cbcbbb.... |
| vcpus               | gauge | vcpu | 94afe31b-659b-4f61-.... | b48cbdf1975f4fd3987.... | 1b8227c2c89e4f1cbcbbb.... |
+---------------------+-------+------+-------------------------+-------------------------+---------------------------+
[3] Configure to enable monitoring Image Service (Glance).
# configure on Image Service Node

root@dlp ~(keystone)#
vi /etc/glance/glance-api.conf
# add into [DEFAULT] section

rpc_backend = rabbit
# add to the end

[oslo_messaging_notifications]
driver = messagingv2

[oslo_messaging_rabbit]
rabbit_host = 10.0.0.30
rabbit_port = 5672
rabbit_userid = openstack
rabbit_password = password 

root@dlp ~(keystone)#
vi /etc/glance/glance-registry.conf
# add into [DEFAULT] section

rpc_backend = rabbit
# add to the end

[oslo_messaging_notifications]
driver = messagingv2

[oslo_messaging_rabbit]
rabbit_host = 10.0.0.30
rabbit_port = 5672
rabbit_userid = openstack
rabbit_password = password 

root@dlp ~(keystone)#
systemctl restart glance-api glance-registry

# after configuring, data is loged like follows when an image is created and so on

root@dlp ~(keystone)#
ceilometer meter-list

+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| Name                | Type  | Unit     | Resource ID                  | User ID                          | Project ID     |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| disk.ephemeral.size | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| disk.root.size      | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| image               | gauge | image    | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| instance            | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| ip.floating         | gauge | ip       | fe1782ca-7e4e-4dee-873a-7... | None                             | c615465cefc... |
| memory              | gauge | MB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| vcpus               | gauge | vcpu     | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+

# add an image

root@dlp ~(keystone)#
glance image-create --name "Ubuntu1604_1" --file /var/kvm/images/ubuntu1604.img --disk-format qcow2 --container-format bare --visibility public

root@dlp ~(keystone)#
ceilometer meter-list

+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| disk.ephemeral.size | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| disk.root.size      | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| image               | gauge | image    | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | e6e04a4d-f13f-419a-8d99-0... | None                             | c615465cefc... |
| instance            | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| ip.floating         | gauge | ip       | fe1782ca-7e4e-4dee-873a-7... | None                             | c615465cefc... |
| memory              | gauge | MB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| vcpus               | gauge | vcpu     | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
# data is loged

[4] Configure to enable monitoring Block Storage (Cinder).
# change settings on Control Node, Network Node

root@dlp ~(keystone)#
vi /etc/cinder/cinder.conf
# add to the end

[oslo_messaging_notifications]
driver = messagingv2

# Control Node

root@dlp ~(keystone)#
systemctl restart cinder-api cinder-scheduler

# Network Node

root@network:~#
systemctl restart cinder-volume

# after configuring, data is loged like follows when a volume is created and so on

root@dlp ~(keystone)#
ceilometer meter-list

+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| disk.ephemeral.size | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| disk.root.size      | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| image               | gauge | image    | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | e6e04a4d-f13f-419a-8d99-0... | None                             | c615465cefc... |
| instance            | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| ip.floating         | gauge | ip       | fe1782ca-7e4e-4dee-873a-7... | None                             | c615465cefc... |
| memory              | gauge | MB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| vcpus               | gauge | vcpu     | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
# create a volume

root@dlp ~(keystone)#
openstack volume create --size 2 disk02

root@dlp ~(keystone)#
ceilometer meter-list

+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| Name                | Type  | Unit     | Resource ID                  | User ID                          | Project ID     |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
| disk.ephemeral.size | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| disk.root.size      | gauge | GB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| image               | gauge | image    | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image               | gauge | image    | e6e04a4d-f13f-419a-8d99-0... | None                             | c615465cefc... |
| image.size          | gauge | B        | 4c8ee57d-c9ba-4f7f-9bd1-d... | None                             | c615465cefc... |
| image.size          | gauge | B        | e6e04a4d-f13f-419a-8d99-0... | None                             | c615465cefc... |
| instance            | gauge | instance | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| ip.floating         | gauge | ip       | fe1782ca-7e4e-4dee-873a-7... | None                             | c615465cefc... |
| memory              | gauge | MB       | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| vcpus               | gauge | vcpu     | cb33e162-391c-42db-90e7-7... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
| volume.size         | gauge | GB       | f1a0e500-33a7-4afb-afec-1... | 185dcfff08524c52b92cac84d52a92d2 | c615465cefc... |
+---------------------+-------+----------+------------------------------+----------------------------------+----------------+
 
Tweet